import React, { Suspense, lazy } from 'react';

// import { BrowserRouter as Router, Route, Switch, Link } from 'react-router-dom';
import { HashRouter as Router, Route, Switch, Link } from 'react-router-dom';

const TopHeader = lazy(() => import('@src/components/LoginHeader'));


const LoginView = lazy(() => import('@pages/login/LoginView'));
const ResetPwdView = lazy(() => import('@pages/login/ResetPwd'));
const RegisterView = lazy(() => import('@pages/login/Register'));
const ImageEditor = lazy(() => import('@pages/login/ImageEditor'));




//loginMask 选直接到index.html写一下样式哈

const AppRouter = () => (
    <Router>

        <Suspense fallback={<div className="loginMask">正在拼命加载...</div>}>
            <TopHeader />
            <Switch>
                <Route exact path="/Login" component={LoginView} />
                <Route path="/ResetPwd" component={ResetPwdView} />
                <Route path="/Register" component={RegisterView} />
                <Route path="/ImageEditor" component={ImageEditor} />
                
                <Route path="/" component={LoginView} />
            </Switch>
        </Suspense>
    </Router>
);

export default AppRouter;